
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{if isset($SEO['title']) && !empty($SEO['title'])}{$SEO['title']}{/if}{$SEO['site_title']}</title>
<meta name="keywords" content="{$SEO['keyword']}">
<meta name="description" content="{$SEO['description']}">
<link href="{THEME_STYLE_PATH}style/css/default_new.css" type="text/css" rel="stylesheet" />
<script src="{THEME_STYLE_PATH}style/js/jquery.min.js"></script>
<script src="{THEME_STYLE_PATH}style/js/core.js"></script>
<link href="{THEME_STYLE_PATH}style/css/percenter1.css" type="text/css" rel="stylesheet" />
<!--[if IE 6]>
<script src="/js/DD_belatedPNG.js"></script>
<script>
  DD_belatedPNG.fix('*');
</script>
<![endif]-->
<!--[if IE 6]>
<style type="text/css">
    html{overflow:hidden;}
    body{height:100%;overflow:auto;}
</style>
<![endif]-->
</head>

<body>
	
	{include template('header','common')}
		<div id="Mainbox">
			<!--插入侧边栏-->
	{include template('sidebar_login','common')}
			<!--插入侧边栏-->
			<!--顶端公告-->
			{include template('top_advance','common')}
			<!-- 左侧 -->
	{include template('member_left','common')}
		<!--右侧-->
				<div class="percenter_right" id="alipayUpdate">
			<div class="aboutper_acc">
			<input type="hidden" id="tbAlipay" value="{$id}"></input>
				<p class="a1" style="margin-bottom:10px;">修改财付通<span style="color:#a3a3a3;float:none;">（最低5元提现）</span></p>
				<ul class="cft_list">
					<li class="a1">姓名：</li>
					<li class="a2"><input type="text" style="width:80px;" id="tbName" value="{$user['username']}">&nbsp;&nbsp;<span class="da3" id="tbName_i">请务必填写您的真实姓名！</span><span class="re1" id="tbName_w" style="display:none;">格式输入有误！</span><img id="tbName_s" src="{THEME_STYLE_PATH}style/images/right.png"  style="vertical-align:-5px;display:none;"/></li>
					<li class="a1">账号：</li>
					<li class="a2"><input type="text" id="tbAccount" value="{$user['account']}"/>&nbsp;&nbsp;<span class="da3" id="tbAccount_i">请输入财付通账号！</span><span class="re1" id="tbAccount_w" style="display:none;">格式输入有误！</span><img id="tbAccount_s" src="{THEME_STYLE_PATH}style/images/right.png"  style="vertical-align:-5px;display:none;"/></li>
					<li class="a1">验证码：</li>
					<li class="a2"><input type="text" style="width:50px;" maxlength="6" id="tbCode"/>&nbsp;&nbsp;<span id="phoneArea"><a href="javascript:void(0);" onclick="getCode()" class="b40link">点击获取验证码</a></span>&nbsp;&nbsp;<span class="da3" id="tbCode_i"></span><span class="re1" id="tbCode_w" style="display:none;"></span><img id="tbCode_s" src="{THEME_STYLE_PATH}style/images/right.png"  style="vertical-align:-5px;display:none;"/></li>
					<li class="a1"></li>
					<li class="a2"><a href="javascript:void(0);" class="editbtn">确认修改</a></li>
				</ul>	
			</div>
		</div>
				<!--右侧-->
		<div class="clear"></div>
	</div>
	<!--主体-->
	<!--尾部-->
	{include template('footer','common')}

	
	

	<!--尾部-->
</body>
</html>
<script type="text/javascript">
var name = $.trim($('#tbName').val());
var account = $.trim($('#tbAccount').val());
var code;
var name_s=account_s=true;var code_s=false;var limit = true;
$(document).ready(function() {
	var v = juxiangyou.component.verification;
	$('#tbName').focus(function(){
		var id = this.id;$('#'+id+'_i').css('color','black');
		switchTip(id,0);
	}).blur(function(){
		var id = this.id;var value = $.trim($(this).val());
		if(value){
			if(v.chkChinese(value)==false){
				$('#'+id+'_w').html('格式输入有误！');name_s = false;switchTip(id,2);
			}else{
				switchTip(id,1);name_s = true;name = value;
			}
		}else{
			$('#'+id+'_i').css('color','#a3a3a3');name_s = false;switchTip(id,0);
		}
	});
	$('#tbAccount').focus(function(){
		var id = this.id;$('#'+id+'_i').css('color','black');
		switchTip(id,0);
	}).blur(function(){
		var id = this.id;var value = $.trim($(this).val());
		if(value){
			if(v.chkMail(value)==false && v.chkPhone(value)==false){
				$('#'+id+'_w').html('格式输入有误！');account_s = false;switchTip(id,2);
			}else{
				switchTip(id,1);account_s = true;account = value;
			}
		}else{
			$('#'+id+'_i').css('color','#a3a3a3');account_s = false;switchTip(id,0);
		}
	});


	$('.editbtn').click(function(){
		if(!limit) return;
		var id = "tbCode";var value = $.trim($("#tbCode").val());
		if(value){
			if(v.chkInt(value,6,6)==false){
					$('#'+id+'_w').html('格式输入有误！');code_s = false;switchTip(id,2);return;
			}
		}else{
			$('#'+id+'_i').css('color','#a3a3a3');code_s = false;switchTip(id,0);return;
		}
		
		name = $('#tbName').val();
		if(!name){
			name_s = false;$('#tbName_i').css('color','black');switchTip('tbName',0);
		}else if(v.chkChinese(name)==false){
			name_s = false;switchTip('tbName',2);
		}else{
			name_s = true;switchTip('tbName',1);
		}
		account = $('#tbAccount').val();
		if(!account){
			account_s = false;$('#tbAccount_i').css('color','black');switchTip('tbAccount',0);
		}else if(v.chkMail(account)==false && v.chkPhone(account)==false && v.chkInt(account,5,12)==false){
			account_s = false;switchTip('tbAccount',2);
		}else{
			account_s = true;switchTip('tbAccount',1);
		}
		


		limit = false;
		if(name_s && account_s ){
			$.ajax({
				type: "POST",
				url: "{U('Member/Account/alipay_edit')}",
				dataType: "json",
				data : {"act":"update",'id':$.trim($('#tbAlipay').val()),"name":name,"account":account,"code":value},
				success: function(data){
					if(data.flag==1){
					    juxiangyou.component.popup._href = "{U('Member/Account/tenpay')}";
						juxiangyou.component.popup.prompt(data.msg,300);
					}else{
						limit = true;
						$('#'+id+'_w').html(data.msg);switchTip(id,2);
					}
				}
			});
		}else{
			limit = true;
		}
	});

});

function getCode()
{
	$.ajax({
		type: "POST",
		url: "{U('Member/Account/tenPay_code')}",
		dataType: "json",
		data : {"act":"getCode"},
		success: function(data){
			if(data.flag ==1){
				ShowSecond(parseInt(60)); 
			}else{
				$('#tbCode_w').html(data.msg);switchTip('tbCode',2);
			}
		}
	});
}
function ShowSecond(cDate)
{
	if(cDate > 1){
		var _html = '<span id="lastTime"><span style="color:red">'+(--cDate)+'</span>秒后可重新发送</span>';
		_html += '(或通过<span style="color:red">微信</span>获取，<a href="#/news/sys/2001" target="_blank" class="b40link">如何获取>></a>)';
		
		$('#phoneArea').html(_html);
		setTimeout("ShowSecond("+cDate+")",1000);
	}
	else{
		var _html = '<a href="javascript:void(0);" onclick="getCode()" class="b40link">点击获取验证码</a>';
		$('#phoneArea').html(_html);
	} 

}


function switchTip(id,sign)
{
	var iObject = $('#'+id+'_i');
	var wObject = $('#'+id+'_w');
	var sObject = $('#'+id+'_s');
	if(sign==1){iObject.hide();wObject.hide();sObject.show();}
	else if(sign==2){iObject.hide();wObject.show();sObject.hide();}
	else{iObject.show();wObject.hide();sObject.hide();}
}
</script>
